About 690 letters

About 3 minutes

#callable

Description: Check if an object is callable.

def callable(obj): ''' Check if an object is callable :param obj: An object :return: True if obj is callable, otherwise False '''

Example:

class Foo: pass class Bar: def __call__(self): pass def func(): pass print('Number', callable(10)) print('Lambda', callable(lambda x: x)) print('Function', callable(func)) print('Foo instance', callable(Foo())) print('Bar instance', callable(Bar()))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Created in 6/9/2025

Updated in 6/9/2025